package com.wl.api.controller.system;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.wl.api.common.annotation.RequiresAuthentication;
import com.wl.api.common.utils.JsonObject;
import com.wl.api.common.utils.StringUtil;
import com.wl.api.common.utils.constant.AppEnum;
import com.wl.api.controller.base.CommonController;
import com.wl.api.dto.business.CustomerUserDTO;
import com.wl.api.service.system.SystemReport;

/**
 * @author wsj
 *提供系统报表
 * */
@RestController
@RequestMapping("/admin/report")
@RequiresAuthentication(getClientType = AppEnum.admin_client, getAuthticationSn="user")

public class SystemReportController extends CommonController {
	
	@Autowired
	SystemReport systemReport;
	
	@RequestMapping(value="/custReport")
	public JsonObject getCustomerList() {
		JsonObject json = JsonObject.getInstance();
		json.setData(systemReport.getRegisterList());
		setJsonMessage(json);
		return json;
	}
	
	@RequestMapping(value="/fundReport")
	public JsonObject getFundList() {
		JsonObject json = JsonObject.getInstance();
		json.setData(systemReport.getFundList());
		setJsonMessage(json);
		return json;
	}
	
	@RequestMapping(value="/orderReport")
	public JsonObject getOrderList() {
		JsonObject json = JsonObject.getInstance();
		json.setData(systemReport.getOrderList());
		setJsonMessage(json);
		return json;
	}	
	
	private void initParam(CustomerUserDTO param) {
		if(StringUtil.isEmpty(param.getAddress())) {
			param.setAddress(null);
		}
		if (StringUtil.isEmpty(param.getUsername())) {
			param.setUsername(null);
		}
}	

}
